package com.liuzh.deviceinfo.tests;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import androidx.fragment.app.Fragment;
import b.l.a.i;
import c.h.a.y.a;
import com.liuzh.deviceinfo.base.BaseFragmentActivity;
import java.util.Objects;

public class TestesActivity extends BaseFragmentActivity {
    public static void B(Context context, Class<? extends a> cls) {
        Intent intent = new Intent(context, TestesActivity.class);
        intent.putExtra("fragmentCls", cls.getName());
        context.startActivity(intent);
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        z();
        if (bundle == null) {
            String stringExtra = getIntent().getStringExtra("fragmentCls");
            if (TextUtils.isEmpty(stringExtra)) {
                finish();
                return;
            }
            try {
                Object newInstance = Class.forName(stringExtra).newInstance();
                if (newInstance instanceof a) {
                    i iVar = (i) o();
                    Objects.requireNonNull(iVar);
                    b.l.a.a aVar = new b.l.a.a(iVar);
                    aVar.f(16908290, (Fragment) newInstance, stringExtra, 1);
                    aVar.j();
                } else {
                    finish();
                }
            } catch (ClassNotFoundException | IllegalAccessException | InstantiationException unused) {
                finish();
            }
        }
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        a aVar = (a) A(16908290);
        if (aVar == null || !aVar.o0(i, keyEvent)) {
            return super.onKeyDown(i, keyEvent);
        }
        return true;
    }

    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        a aVar = (a) A(16908290);
        if (aVar == null || !aVar.p0(i, keyEvent)) {
            return super.onKeyUp(i, keyEvent);
        }
        return true;
    }
}
